home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / bc7tb523.zip / MIXED.DOC < prev    next >
Text File  |  1992-05-12  |  32KB  |  779 lines

  1.  
  2.             MIXED-LANGUAGE TOOLBOX FOR QuickBASIC
  3.             ─────────────────────────────────────
  4.                       By Christy Gemmell
  5.  
  6.  
  7. These are native QuickBASIC functions and procedures which call the
  8. machine-code routines in the Assembly-Language Toolbox for QuickBASIC.
  9. To use them, you must link both TOOLBOX.LIB, from the Assembly-Language
  10. Library disk, and the copy of MIXED.LIB from the Mixed-Language Library
  11. disk to your stand-alone programs, like this:
  12.  
  13.     LINK yourprog,,,toolbox.lib mixed.lib;
  14.  
  15. Since the QuickBASIC environment only allows one Quick Library to be
  16. loaded at a time, however, the version of MIXED.QLB supplied also
  17. contains all the routines from TOOLBOX.LIB. This allows you to use the
  18. environment to develop and test programs which use functions from 
  19. both libraries. Just start QuickBASIC with the command:
  20.  
  21.     QB(X) yourprog /L mixed.qlb
  22.  
  23. You can even build your own Quick Libraries, incorporating Toolbox
  24. routines, using the QuickBASIC Linker as follows:
  25.  
  26.     LINK /QU yoursub.obj yourfun.obj toolbox.lib mixed.lib,,bqlb45.lib;
  27.  
  28. BQLB45.LIB is the special interface library supplied with Microsoft's
  29. QuickBASIC 4.5 compiler. Substitute the following library names for other
  30. versions of the language.
  31.  
  32.     BQLB40.LIB          for QuickBASIC 4.0
  33.     BQLB41.LIB          for BASIC 6.0
  34.     QBXQLB.LIB          for BASIC 7.0 and 7.1 PDS
  35.  
  36. Be sure that, whichever interface library you use, it can be found by
  37. LINK.EXE when the library is being built. This can be done, either by
  38. copying it to the Linker's own directory or to a subdirectory pointed to
  39. by a LIB= environment variable in your AUTOEXEC.BAT file, for example:
  40.  
  41.     SET LIB=C:\QB45\LIBRARY
  42.  
  43. See your MS-DOS or PC-DOS manual for more information about environment
  44. variables.
  45.  
  46. If you have the Professional version of the Assembly-Language Toolbox,
  47. of course, building customised libraries is much easier since a full
  48. set of object (.OBJ) modules, together with source code, is supplied
  49. with this release.
  50.  
  51. The stand-alone (.LIB) and Quick Library (.QLB) versions of the Mixed-
  52. Language Toolbox both contain the following SUB programs and FUNCTION
  53. procedures:
  54.  
  55.  
  56. BARMENU
  57.  
  58. Creates and operates a menu orientated horizontally on the screen row
  59. specified. The calling program must supply :
  60.  
  61. Row%        =   The screen row on which the menu bar will appear.
  62. Atr%        =   The display attribute or colour for the menu bar.
  63. Opt%        =   Number of options available for selection.
  64. Menu$()     =   String array containing selection list. Menu$(0) should
  65.                 be set to a string of ASCII characters, corresponding to
  66.                 the initial or key letter of each option in the list.
  67.                 Insert a space at the appropriate position of an option
  68.                 to be disabled. In the remaining option strings an
  69.                 ampersand '&' indicates that the next character is the
  70.                 Hotkey to be highlighted for that option.
  71. Bar%        =   The menu selection to be highlighted on entry into the
  72.                 procedure.
  73. Nxt%        =   If set, this flag just causes the menu to be refreshed
  74.                 without pausing for a selection from the user. This is
  75.                 used to handle presses on the Right or Left Arrow keys
  76.                 in the Pull-Down Menu procedure.
  77. Ctx%        =   If set, this flag indicates that context-sensitive help
  78.                 is available, in which case ...
  79. Tpc$        =   The root name of the Topic file to be displayed if the
  80.                 user presses <F1> for help. The current selection number
  81.                 is appended to this to produce the actual filename.
  82.  
  83.                 eg, if Tpc$ = "CONFIG" and Bar% = 3
  84.                 
  85.                 HelpMate (see TOOLBOX.DOC) will look for a Topic file
  86.                 named CONFIG3.HLP.
  87. Mouse%      =   If set, this flag indicates that a mouse is installed
  88.                 and can be used to make selections.
  89. HotKeys%    =   If set, this flag allows hotkeys to go directly to a
  90.                 selection without you having to press <ENTER> as well.
  91.  
  92. DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%, Ctx%,_
  93.                      Topic$, Mouse%, HotKeys%)
  94.  
  95. On completion the procedure returns with the following variable set:
  96.  
  97. Bar%        =   Number of selection made by user. If zero then the
  98.                 <Escape> key was pressed to abort the procedure
  99.                 without making a selection.
  100.  
  101. VERMENU (see below) is a similar procedure which operates a vertically
  102. orientated point-and-shoot type menu.
  103.  
  104. See the source code of DEMON.BAS, the Toolbox demonstration program, for
  105. examples of BARMENU and VERMENU in use.
  106.  
  107.  
  108. BINDEC
  109.  
  110. Translates a string of binary digits to their long integer decimal
  111. equivalent.
  112.  
  113. DECLARE FUNCTION BinDec& (Binary$)
  114.  
  115.  
  116. CAPITAL
  117.  
  118. Converts all alphabetic characters in a string to lower-case,
  119. except for the first character of each word, which is forced
  120. to upper-case.
  121.  
  122. DECLARE FUNCTION CapItal$ (Original$)
  123.  
  124. This function is designed for use in printing address labels
  125. and can correctly identify and format proper surnames like
  126. 'McLaughlin'.
  127.  
  128.  
  129. CENTRE
  130.  
  131. Centres the string supplied within an empty string of specified width.
  132.  
  133. DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
  134.  
  135. This function is called by the VERMENU routine (see below) to centre the
  136. title of a pull-down menu within the window it refers to.
  137.  
  138.  
  139. CHECKPRINTER
  140.  
  141. This procedure checks if the specified parallel printer is ready and
  142. on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
  143. not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
  144. row of the screen and waits for the operator to correct the problem and
  145. press a key.
  146.  
  147. If the user presses <Escape>, the procedure returns with Ready% set to
  148. zero (FALSE). Any other keystroke causes it to go back and test the
  149. printer again. CHECKPRINTER will not return until either the printer is
  150. ready for output, or the <Escape> key is pressed.
  151.  
  152. DECLARE SUB CheckPrinter (Printer%, Ready%)
  153.  
  154. Printer% is the number of the parallel printer to test (1 = LPT1: etc).
  155.  
  156. Example:    CheckPrinter 1, Ready%              ' Test LPT1:
  157.             IF NOT Ready% THEN
  158.                STOP
  159.             ELSE
  160.                LPRINT Stuff$
  161.             END IF 
  162.  
  163.  
  164. DATEINPUT
  165.  
  166. Accepts and verifies date input in a Reverse Video entry panel, all the
  167. usual editing keys are supported and entry is terminated by either a
  168. Carriage Return or one of several special function keys (see below).
  169.  
  170. DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  171.  
  172. Default$    =  default string which can be accepted by just pressing
  173.                the <Enter> key.
  174. Context%    =  set TRUE if context-sensitive help is available, in
  175.                which case ... 
  176. Topic$      =  name of the HELP Topic file to display whenever the
  177.                <F1> key is pressed. 
  178. HotKey%     =  If entry is terminated by anything other than the
  179.                <Enter> key, this variable will contain an explanatory
  180.                return code ..
  181.  
  182. Return Codes:   1  =  <Escape> abort entry returning a null string
  183.                 2  =  <F2>     repeat previous entry for this field
  184.                 3  =  <Up Arr> pressed, move to previous field 
  185.                 4  =  <Dn Arr> pressed, move to next field
  186.                 5  =  <Pg Up>  pressed, move to top of screen
  187.                 6  =  <Pg Dn>  pressed, move to end of screen
  188.  
  189. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  190.                 <R.Arrow>   =  Move cursor one character to the right
  191.                 <Home>      =  Move cursor to first character of field
  192.                 <End>       =  Move cursor to last character of field
  193.                 <Ctrl End>  =  Clear from current cursor position to
  194.                                the end of the entry field.
  195.                 <BackSpace> =  Replace character under cursor with a
  196.                                blank space and move cursor one character
  197.                                to the left.
  198.